<?php

function news_slides_shortcode( $atts, $content = null ) {
	
	extract(shortcode_atts(array(
		"category" => '',
		"post_limit" => '',
	), $atts));
	
	global $wp_query,$paged,$post;
	$temp = $wp_query;
	$wp_query= null;
	$wp_query = new WP_Query();
	
	if( $atts['post_limit'] ) { $query .= '&posts_per_page=' . $atts['post_limit']; }
	if( $atts['category'] ) { $query .= '&category_name=' . $atts['category']; }
	
	if(!empty($query)){
		$query .= $query;
	}
	
	$wp_query->query($query);
	ob_start();
	?>
	
	<div class="slider clearfix">
		<ul class="slides">
			<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
				<?php get_template_part( 'loop', 'style3' ); ?>
			<?php endwhile; ?>
		</ul>
	</div>
	
	<?php $wp_query = null; $wp_query = $temp;
	$content = ob_get_contents();
	ob_end_clean();
	return $content;
	
}

add_shortcode( 'news_slides', 'news_slides_shortcode' );

?>